this._border.connect('repaint', this._drawBorder.bind(this));
this.add_actor(this._border);
this.bin.raise(this._border);
- this._xOffset = 0;
- this._yOffset = 0;
- this._xPosition = 0;
- this._yPosition = 0;
this._sourceAlignment = 0.5;
this._capturedEventId = 0;
this._muteInput();
if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) {
case St.Side.TOP:
- this.yOffset = -rise;
+ this.translation_y = -rise;
break;
case St.Side.BOTTOM:
- this.yOffset = rise;
+ this.translation_y = rise;
break;
case St.Side.LEFT:
- this.xOffset = -rise;
+ this.translation_x = -rise;
break;
case St.Side.RIGHT:
- this.xOffset = rise;
+ this.translation_x = rise;
break;
}
}
Tweener.addTween(this, { opacity: 255,
- xOffset: 0,
- yOffset: 0,
+ translation_x: 0,
+ translation_y: 0,
transition: 'linear',
onComplete: () => {
this._unmuteInput();
if (!this.visible)
return;
- let xOffset = 0;
- let yOffset = 0;
+ let translationX = 0;
+ let translationY = 0;
let themeNode = this.get_theme_node();
let rise = themeNode.get_length('-arrow-rise');
let fade = (animate & PopupAnimation.FADE);
if (animate & PopupAnimation.SLIDE) {
switch (this._arrowSide) {
case St.Side.TOP:
- yOffset = rise;
+ translationY = rise;
break;
case St.Side.BOTTOM:
- yOffset = -rise;
+ translationY = -rise;
break;
case St.Side.LEFT:
- xOffset = rise;
+ translationX = rise;
break;
case St.Side.RIGHT:
- xOffset = -rise;
+ translationX = -rise;
break;
}
}
Tweener.removeTweens(this);
Tweener.addTween(this, { opacity: fade ? 0 : 255,
- xOffset: xOffset,
- yOffset: yOffset,
+ translation_x: translationX,
+ translation_y: translationY,
transition: 'linear',
time: animationTime,
onComplete: () => {
this.hide();
this.opacity = 0;
- this.xOffset = 0;
- this.yOffset = 0;
+ this.translation_x = 0;
+ this.translation_y = 0;
if (onComplete)
onComplete();
}
parent = parent.get_parent();
}
- this._xPosition = Math.floor(x);
- this._yPosition = Math.floor(y);
- this._shiftActor();
+ // Actually set the position
+ this.x = Math.floor(x);
+ this.y = Math.floor(y);
}
// @origin: Coordinate specifying middle of the arrow, along
}
}
- _shiftActor() {
- // Since the position of the BoxPointer depends on the allocated size
- // of the BoxPointer and the position of the source actor, trying
- // to position the BoxPointer via the x/y properties will result in
- // allocation loops and warnings. Instead we do the positioning via
- // the anchor point, which is independent of allocation, and leave
- // x == y == 0.
- this.set_anchor_point(-(this._xPosition + this._xOffset),
- -(this._yPosition + this._yOffset));
- }
-
_calculateArrowSide(arrowSide) {
let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor);
let [minWidth, minHeight, boxWidth, boxHeight] = this.get_preferred_size();
}
}
- set xOffset(offset) {
- this._xOffset = offset;
- this._shiftActor();
- }
-
- get xOffset() {
- return this._xOffset;
- }
-
- set yOffset(offset) {
- this._yOffset = offset;
- this._shiftActor();
- }
-
- get yOffset() {
- return this._yOffset;
- }
-
updateArrowSide(side) {
this._arrowSide = side;
this._border.queue_repaint();